home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / aminet / util / cli / diff22pa.lha / Diff.patch
Encoding:
Text File  |  1993-04-04  |  50.3 KB  |  1,946 lines

  1. --- Diff22:ifdef.c    Wed Sep 30 03:21:58 1992
  2. +++ ifdef.c    Sun Apr 04 19:39:37 1993
  3. @@ -21,10 +21,16 @@
  4.  
  5.  #include "diff.h"
  6.  
  7. +#ifdef KULTUR
  8. +static void print_ifdef_hunk (struct change *hunk);
  9. +static void format_ifdef (const char *format, int beg0, int end0, int beg1, int end1);
  10. +static void print_ifdef_lines (const char *format, const struct file_data *current, int from, int upto);
  11. +#else
  12.  static void format_ifdef ();
  13.  static void print_ifdef_hunk ();
  14.  static void print_ifdef_lines ();
  15.  struct change *find_change ();
  16. +#endif
  17.  
  18.  static int next_line;
  19.  
  20. --- Diff22:getopt1.c    Sun Jan 17 18:51:30 1993
  21. +++ getopt1.c    Sun Apr 04 20:34:29 1993
  22. @@ -21,9 +21,11 @@
  23.  
  24.  #include "getopt.h"
  25.  
  26. +#ifndef __SASC_60
  27.  #if !__STDC__ && !defined(const) && IN_GCC
  28.  #define const
  29.  #endif
  30. +#endif
  31.  
  32.  #include <stdio.h>
  33.  
  34. --- Diff22:getopt.c    Sun Jan 17 18:50:26 1993
  35. +++ getopt.c    Sun Apr 04 20:33:18 1993
  36. @@ -42,9 +42,11 @@
  37.  #endif /* alloca.h */
  38.  #endif /* not __GNUC__ */
  39.  
  40. +#ifndef __SASC_60
  41.  #if !__STDC__ && !defined(const) && IN_GCC
  42.  #define const
  43.  #endif
  44. +#endif
  45.  
  46.  #include <stdio.h>
  47.  
  48. @@ -150,6 +152,16 @@
  49.    REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
  50.  } ordering;
  51.  
  52. +#ifdef KULTUR
  53. +#include <string.h>
  54. +#include <stdlib.h>
  55. +#define    my_index    strchr
  56. +#define    my_bcopy(src, dst, n)    memcpy ((dst), (src), (n))
  57. +
  58. +static void exchange (char **);
  59. +int getopt (int, char *const *, const char *);
  60. +#else
  61. +
  62.  #ifdef    __GNU_LIBRARY__
  63.  /* We want to avoid inclusion of string.h with non-GNU libraries
  64.     because there are many ways it can cause trouble.
  65. @@ -189,6 +201,7 @@
  66.      to[i] = from[i];
  67.  }
  68.  #endif                /* GNU C library.  */
  69. +#endif
  70.  
  71.  /* Handle permutation of arguments.  */
  72.  
  73. @@ -213,7 +226,11 @@
  74.       char **argv;
  75.  {
  76.    int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *);
  77. +#ifdef KULTUR
  78. +  char **temp = (char **) malloc (nonopts_size);
  79. +#else
  80.    char **temp = (char **) __alloca (nonopts_size);
  81. +#endif
  82.  
  83.    /* Interchange the two blocks of data in ARGV.  */
  84.  
  85. @@ -228,6 +245,9 @@
  86.  
  87.    first_nonopt += (optind - last_nonopt);
  88.    last_nonopt = optind;
  89. +#ifdef KULTUR
  90. +  free (temp);
  91. +#endif
  92.  }
  93.  
  94.  /* Scan elements of ARGV (whose length is ARGC) for option characters
  95. --- Diff22:error.c    Sat Jul 18 12:23:10 1992
  96. +++ error.c    Sun Apr 04 19:39:29 1993
  97. @@ -19,6 +19,10 @@
  98.  
  99.  #include <stdio.h>
  100.  
  101. +#ifdef KULTUR
  102. +void error (int status, int errnum, char *message, ...);
  103. +#endif
  104. +
  105.  #ifdef HAVE_VPRINTF
  106.  
  107.  #if __STDC__
  108. --- Diff22:ed.c    Sat Sep 05 22:35:52 1992
  109. +++ ed.c    Sun Apr 04 19:39:26 1993
  110. @@ -19,6 +19,11 @@
  111.  
  112.  #include "diff.h"
  113.  
  114. +#ifdef KULTUR
  115. +static void print_ed_hunk (struct change *);
  116. +static void print_rcs_hunk (struct change *);
  117. +static void pr_forward_ed_hunk (struct change *);
  118. +#else
  119.  int change_letter ();
  120.  int translate_line_number ();
  121.  static void print_rcs_hunk ();
  122. @@ -27,6 +32,7 @@
  123.  void translate_range ();
  124.  struct change *find_change ();
  125.  struct change *find_reverse_change ();
  126. +#endif
  127.  
  128.  /* Print our script as ed commands.  */
  129.  
  130. --- Diff22:dir.c    Thu Feb 11 02:36:08 1993
  131. +++ dir.c    Sun Apr 04 19:39:23 1993
  132. @@ -19,8 +19,6 @@
  133.  
  134.  #include "diff.h"
  135.  
  136. -static int compare_names ();
  137. -
  138.  /* Read the directory named by DIR and store into DIRDATA a sorted vector
  139.     of filenames for its contents.  DIR->desc == -1 means this directory is
  140.     known to be nonexistent, so set DIRDATA to an empty vector.
  141. @@ -32,6 +30,13 @@
  142.    char *data;    /* Allocated storage for file names.  */
  143.  };
  144.  
  145. +#ifdef KULTUR
  146. +static int compare_names (char **file1, char **file2);
  147. +static int dir_sort (struct file_data *dir, struct dirdata *dirdata);
  148. +#else
  149. +static int compare_names ();
  150. +#endif
  151. +
  152.  static int
  153.  dir_sort (dir, dirdata)
  154.       struct file_data *dir;
  155. @@ -152,7 +157,11 @@
  156.  int
  157.  diff_dirs (filevec, handle_file, depth)
  158.       struct file_data filevec[];
  159. +#ifdef KULTUR
  160. +     int (*handle_file) (char *, char *, char *, char *, int);
  161. +#else
  162.       int (*handle_file) ();
  163. +#endif
  164.       int depth;
  165.  {
  166.    struct dirdata dirdata[2];
  167. --- Diff22:diff3.c    Thu Feb 11 12:48:30 1993
  168. +++ diff3.c    Sun Apr 04 20:34:18 1993
  169. @@ -28,6 +28,22 @@
  170.  #include "getopt.h"
  171.  #include "system.h"
  172.  
  173. +#ifdef AMIGA
  174. +#include <signal.h>
  175. +#ifdef KULTUR
  176. +#pragma msg 149 ignore push
  177. +#endif
  178. +#include <exec/types.h>
  179. +#include <dos/dostags.h>
  180. +#include <proto/dos.h>
  181. +#include <proto/exec.h>
  182. +#ifdef KULTUR
  183. +#pragma msg 149 pop
  184. +#endif
  185. +
  186. +extern struct DosLibrary *DOSBase;
  187. +#endif /* AMIGA */
  188. +
  189.  /*
  190.   * Internal data structures and macros for the diff3 program; includes
  191.   * data structures for both diff3 diffs and normal diffs.
  192. @@ -176,6 +192,30 @@
  193.  /*
  194.   * Forward function declarations.
  195.   */
  196. +#ifdef KULTUR
  197. +static void usage (void);
  198. +static struct diff3_block *make_3way_diff (struct diff_block *, struct diff_block *);
  199. +static struct diff3_block *using_to_diff3_block (struct diff_block *[2], struct diff_block *[2], int, int, struct diff3_block *);
  200. +static int copy_stringlist (char *[], int *, char *[], int *, int);
  201. +static struct diff3_block *create_diff3_block (int, int, int, int, int, int);
  202. +static int compare_line_list (char *[], int *, char *[], int *, int);
  203. +static struct diff_block *process_diff (char *, char *);
  204. +static enum diff_type process_diff_control (char **, struct diff_block *);
  205. +static char *read_diff (char *, char *, char **);
  206. +static char *scan_diff_line (char *, char **, int *, char *, char);
  207. +static void output_diff3 (FILE *, struct diff3_block *, int [3], int [3]);
  208. +static int dotlines (FILE *, struct diff3_block *b, int);
  209. +static void undotlines (FILE *, int, int, int);
  210. +static int output_diff3_edscript (FILE *, struct diff3_block *, int [3], int [3], char *, char *, char *);
  211. +static int output_diff3_merge (FILE *, FILE *, struct diff3_block *, int [3], int [3], char *, char *, char *);
  212. +static struct diff3_block *reverse_diff3_blocklist (struct diff3_block *);
  213. +static int myread (int fd, char *ptr, int size);
  214. +static void fatal (char *);
  215. +static void perror_with_exit (char *);
  216. +VOID *xmalloc (unsigned);
  217. +static VOID *xrealloc (VOID *, unsigned);
  218. +#define DIFF_PROGRAM "diff"
  219. +#else
  220.  static int myread ();
  221.  static void fatal ();
  222.  static void perror_with_exit ();
  223. @@ -197,8 +237,12 @@
  224.  
  225.  static struct diff3_block *reverse_diff3_blocklist ();
  226.  
  227. +#ifndef KULTUR
  228.  VOID *xmalloc ();
  229.  static VOID *xrealloc ();
  230. +#endif
  231. +
  232. +#endif
  233.  
  234.  static char diff_program[] = DIFF_PROGRAM;
  235.  
  236. @@ -240,6 +284,13 @@
  237.    char **file;
  238.    struct stat statb;
  239.  
  240. +#ifdef AMIGA
  241. +  if (DOSBase->dl_lib.lib_Version < 37) {
  242. +    fputs ("Need Amiga OS 2.0 (V.37) to execute.\n", stderr);
  243. +    exit (20);
  244. +  }
  245. +#endif /* AMIGA */
  246. +
  247.    incompat = 0;
  248.  
  249.    argv0 = argv[0];
  250. @@ -596,7 +647,9 @@
  251.        if (high_water_mark < D_HIGHLINE (other_diff, FC))
  252.          {
  253.            high_water_thread ^= 1;
  254. +#ifndef KULTUR
  255.            high_water_diff = other_diff;
  256. +#endif
  257.            high_water_mark = D_HIGHLINE (other_diff, FC);
  258.          }
  259.  
  260. @@ -1089,6 +1142,8 @@
  261.       char *filea, *fileb;
  262.       char **output_placement;
  263.  {
  264. +#ifndef AMIGA
  265. +
  266.    char *argv[6];
  267.    char **ap;
  268.    int fds[2];
  269. @@ -1132,6 +1187,86 @@
  270.      perror_with_exit ("fork failed");
  271.  
  272.    close (fds[1]);        /* Prevent erroneous lack of EOF */
  273. +
  274. +#else /* AMIGA */
  275. +
  276. +  static char diff_command_line[200];
  277. +  int fds[2];
  278. +  char *diff_result;
  279. +  int current_chunk_size;
  280. +  int bytes;
  281. +  int total;
  282. +  void (*oldsigint)();
  283. +  static long num_invocations = 0;
  284. +  char pipe_name[20];
  285. +  struct Task *Task;
  286. +  struct TagItem STags[5];
  287. +  BPTR StdOutDiff;
  288. +
  289. +  /* The user should not be able to break the program while the child
  290. +     process is being executed, otherwise the child process will still
  291. +     be writing to the pipe-device until it deadlocks because there is
  292. +     no reader on the other side of the pipe. So prohibit breaking the
  293. +     program until the pipe is closed. */
  294. +  oldsigint = signal (SIGINT, SIG_IGN);
  295. +
  296. +  /* Construct command line. Enclose filenames in double quotes in
  297. +     case the user specifies files with spaces in their names. */
  298. +  strcpy (diff_command_line, diff_program);
  299. +  if (always_text)
  300. +    strcat (diff_command_line, " -a");
  301. +  strcat (diff_command_line, " --");
  302. +  strcat (diff_command_line, " \"");
  303. +  strcat (diff_command_line, filea);
  304. +  strcat (diff_command_line, "\" \"");
  305. +  strcat (diff_command_line, fileb);
  306. +  strcat (diff_command_line, "\"");
  307. +
  308. +  /* Construct filename for the pipe to be used */
  309. +  Task = FindTask (NULL);
  310. +  num_invocations++;
  311. +  sprintf (pipe_name, "PIPE:%08lX_%ld", Task, num_invocations);
  312. +
  313. +  /* Open pipe for child process */
  314. +  StdOutDiff = Open (pipe_name, MODE_NEWFILE);
  315. +  if (!StdOutDiff)
  316. +    perror_with_exit ("pipe failed");
  317. +
  318. +  /* Child process runs asynchronously with pipe as stdout */
  319. +#ifdef KULTUR
  320. +  STags[0].ti_Tag = (Tag) SYS_Input;
  321. +  STags[0].ti_Data = NULL;
  322. +  STags[1].ti_Tag = (Tag) SYS_Output;
  323. +  STags[1].ti_Data = StdOutDiff;
  324. +  STags[2].ti_Tag = (Tag) SYS_Asynch;
  325. +  STags[2].ti_Data = TRUE;
  326. +  STags[3].ti_Tag = (Tag) SYS_UserShell;
  327. +#else
  328. +  STags[0].ti_Tag = SYS_Input;
  329. +  STags[0].ti_Data = NULL;
  330. +  STags[1].ti_Tag = SYS_Output;
  331. +  STags[1].ti_Data = StdOutDiff;
  332. +  STags[2].ti_Tag = SYS_Asynch;
  333. +  STags[2].ti_Data = TRUE;
  334. +  STags[3].ti_Tag = SYS_UserShell;
  335. +#endif
  336. +  STags[3].ti_Data = TRUE;
  337. +  STags[4].ti_Tag = TAG_DONE;
  338. +  /* Start child process */
  339. +  if ((System (diff_command_line, STags)) != 0) {
  340. +    Close (StdOutDiff);
  341. +    perror_with_exit ("diff: not found");
  342. +  }
  343. +
  344. +  /* Open pipe for this side of the communication */
  345. +  fds[0] = open (pipe_name, O_RDONLY);
  346. +  if (fds[0] < 0) {
  347. +    Close (StdOutDiff);
  348. +    perror_with_exit ("pipe failed");
  349. +  }
  350. +
  351. +#endif /* !AMIGA */
  352. +
  353.    current_chunk_size = DIFF_CHUNK_SIZE;
  354.    diff_result = (char *) xmalloc (current_chunk_size);
  355.    total = 0;
  356. @@ -1149,6 +1284,7 @@
  357.  
  358.    *output_placement = diff_result;
  359.  
  360. +#ifndef AMIGA
  361.    do
  362.      if ((w = wait (&wstatus)) == -1)
  363.        perror_with_exit ("wait failed");
  364. @@ -1156,6 +1292,12 @@
  365.  
  366.    if (! (WIFEXITED (wstatus) && WEXITSTATUS (wstatus) < 2))
  367.      fatal ("subsidiary diff failed");
  368. +#else /* AMIGA */
  369. +  /* Close pipe */
  370. +  close (fds[0]);
  371. +  /* Re-install break-handler */
  372. +  signal (SIGINT, oldsigint);
  373. +#endif /* !AMIGA */
  374.  
  375.    return diff_result + total;
  376.  }
  377. @@ -1168,12 +1310,16 @@
  378.   * This next routine began life as a macro and many parameters in it
  379.   * are used as call-by-reference values.
  380.   */
  381. +#ifdef KULTUR
  382. +static char *scan_diff_line (char *scan_ptr, char **set_start, int *set_length, char *limit, char firstchar)
  383. +#else
  384.  static char *
  385.  scan_diff_line (scan_ptr, set_start, set_length, limit, firstchar)
  386.       char *scan_ptr, **set_start;
  387.       int *set_length;
  388.       char *limit;
  389.       char firstchar;
  390. +#endif
  391.  {
  392.    char *line_ptr;
  393.  
  394. @@ -1638,7 +1784,11 @@
  395.    return result;
  396.  }
  397.  
  398. +#ifndef AMIGA
  399. +static VOID *
  400. +#else /* AMIGA */
  401.  VOID *
  402. +#endif /* !AMIGA */
  403.  xmalloc (size)
  404.       unsigned size;
  405.  {
  406. --- Diff22:diff.c    Wed Nov 18 10:17:00 1992
  407. +++ diff.c    Sun Apr 04 19:39:11 1993
  408. @@ -33,6 +33,18 @@
  409.  #define GUTTER_WIDTH_MINIMUM 3
  410.  #endif
  411.  
  412. +#ifdef KULTUR
  413. +static char *option_list (char **, int);
  414. +static int add_exclude_file (void);
  415. +static int ck_atoi (char *, int *);
  416. +static int compare_files (char *, char *, char *, char *, int);
  417. +static int fake_stat_result (struct stat *);
  418. +static int specify_format (const char **, const char *);
  419. +static void add_exclude (const char *);
  420. +static void add_regexp (struct regexp_list **, char *);
  421. +static void specify_style (enum output_style);
  422. +static void usage (void);
  423. +#else
  424.  int diff_dirs ();
  425.  int diff_2_files ();
  426.  
  427. @@ -41,6 +53,10 @@
  428.  static void add_regexp();
  429.  static void specify_style ();
  430.  static void usage ();
  431. +#ifdef AMIGA
  432. +static int fake_stat_result ();
  433. +#endif /* AMIGA */
  434. +#endif
  435.  
  436.  /* Nonzero for -r: if comparing two directories,
  437.     compare their common subdirectories recursively.  */
  438. @@ -123,14 +139,18 @@
  439.      exclude = (const char **)
  440.            (exclude_alloc == 0
  441.             ? xmalloc ((exclude_alloc = 64) * sizeof (*exclude))
  442. -           : xrealloc (exclude, (exclude_alloc *= 2) * sizeof (*exclude)));
  443. +           : xrealloc ((VOID *)exclude, (exclude_alloc *= 2) * sizeof (*exclude)));
  444.  
  445.    exclude[exclude_count++] = pattern;
  446.  }
  447.  
  448.  static int
  449. +#ifdef KULTUR
  450. +add_exclude_file (void)
  451. +#else
  452.  add_exclude_file (name)
  453.       const char *name;
  454. +#endif
  455.  {
  456.    struct file_data f;
  457.    char *p, *q, *lim;
  458. @@ -477,7 +497,11 @@
  459.        break;
  460.  
  461.      case 'X':
  462. +#ifdef KULTUR
  463. +      if (add_exclude_file () != 0)
  464. +#else
  465.        if (add_exclude_file (optarg) != 0)
  466. +#endif
  467.          pfatal_with_name (optarg);
  468.        break;
  469.  
  470. @@ -579,8 +603,8 @@
  471.        if (!group_format[UNCHANGED])
  472.      group_format[UNCHANGED] = "%=";
  473.        if (!group_format[CHANGED])
  474. -    group_format[CHANGED] = concat (group_format[OLD],
  475. -                    group_format[NEW], "");
  476. +    group_format[CHANGED] = concat ((char *) group_format[OLD],
  477. +                    (char *) group_format[NEW], "");
  478.      }
  479.  
  480.    no_diff_means_no_output =
  481. @@ -618,7 +642,7 @@
  482.    r->buf.fastmap = (char *) xmalloc (256);
  483.    m = re_compile_pattern (pattern, strlen (pattern), &r->buf);
  484.    if (m != 0)
  485. -    error ("%s: %s", pattern, m);
  486. +    error ("%s: %s", pattern, (char *) m);
  487.  
  488.    /* Add to the start of the list, since it's easier than the end.  */
  489.    r->next = *reglist;
  490. @@ -918,3 +942,22 @@
  491.  
  492.    return val;
  493.  }
  494. +
  495. +#ifdef AMIGA
  496. +static int fake_stat_result (sbuf)
  497. +     struct stat *sbuf;
  498. +{
  499. +  time_t cur_time;
  500. +
  501. +  time (&cur_time);
  502. +  sbuf->st_dev = 0;
  503. +  sbuf->st_ino = 0;
  504. +  sbuf->st_mode = S_IREAD;
  505. +  sbuf->st_nlink = 1;
  506. +  sbuf->st_uid = 0;
  507. +  sbuf->st_gid = 0;
  508. +  sbuf->st_size = 0;
  509. +  sbuf->st_ctime = sbuf->st_atime = sbuf->st_mtime = cur_time;
  510. +  return 0;
  511. +}
  512. +#endif /* AMIGA */
  513. --- Diff22:context.c    Sun Oct 18 22:33:04 1992
  514. +++ context.c    Sun Apr 04 19:38:59 1993
  515. @@ -19,11 +19,22 @@
  516.  
  517.  #include "diff.h"
  518.  
  519. +#ifdef KULTUR
  520. +static struct change *find_hunk (struct change *);
  521. +static void find_function (struct file_data *, int, const char **, int *);
  522. +static void mark_ignorable (struct change *);
  523. +static void print_context_label (const char *, struct file_data *, const char *);
  524. +static void print_context_number_range (struct file_data *, int, int);
  525. +static void print_unidiff_number_range (struct file_data *, int, int);
  526. +static void pr_context_hunk (struct change *);
  527. +static void pr_unidiff_hunk (struct change *);
  528. +#else
  529.  static void pr_context_hunk ();
  530.  static void pr_unidiff_hunk ();
  531.  static struct change *find_hunk ();
  532.  static void mark_ignorable ();
  533.  static void find_function ();
  534. +#endif
  535.  
  536.  /* Last place find_function started searching from.  */
  537.  static int find_function_last_search;
  538. --- Diff22:cmp.c    Wed Jul 08 13:58:06 1992
  539. +++ cmp.c    Sun Apr 04 19:38:53 1993
  540. @@ -21,6 +21,19 @@
  541.  #include "system.h"
  542.  #include "getopt.h"
  543.  
  544. +#ifdef KULTUR
  545. +extern void *xmalloc (unsigned);
  546. +extern void error (int, int, char *, ...);
  547. +static int block_compare_and_count (int *count, char *p1, char *p2, unsigned char c);
  548. +static int block_compare (char *p1, char *p2);
  549. +static int block_read (int fd, char *buf, int nchars);
  550. +static void printc (FILE *fs, int width, unsigned c);
  551. +static void usage (char *reason);
  552. +static int cmp (void);
  553. +#ifdef AMIGA
  554. +static void fake_stat_result (struct stat *sbuf);
  555. +#endif
  556. +#else
  557.  char *xmalloc ();
  558.  int block_compare ();
  559.  int block_compare_and_count ();
  560. @@ -28,6 +41,10 @@
  561.  int cmp ();
  562.  void printc ();
  563.  void error ();
  564. +#ifdef AMIGA
  565. +void fake_stat_result ();
  566. +#endif /* AMIGA */
  567. +#endif
  568.  
  569.  /* Name under which this program was invoked.  */
  570.  char *program_name;
  571. @@ -71,7 +88,7 @@
  572.    {NULL, 0, NULL, 0}
  573.  };
  574.  
  575. -void
  576. +static void
  577.  usage (reason)
  578.       char *reason;
  579.  {
  580. @@ -235,7 +252,7 @@
  581.     using `buf1' and `buf2'.
  582.     Return 0 if identical, 1 if different, >1 if error. */
  583.  
  584. -int
  585. +static int
  586.  cmp ()
  587.  {
  588.    long line_number = 1;        /* Line number (1...) of first difference. */
  589. @@ -368,11 +385,15 @@
  590.     Return the offset of the first byte that differs.
  591.     Place the count at the address pointed to by COUNT.  */
  592.  
  593. -int
  594. +static int
  595. +#ifdef KULTUR
  596. +block_compare_and_count (int *count, char *p1, char *p2, unsigned char c)
  597. +#else
  598.  block_compare_and_count (count, p1, p2, c)
  599.       int *count;
  600.       char *p1, *p2;
  601.       unsigned char c;
  602. +#endif
  603.  {
  604.    long w;            /* Word for counting C. */
  605.    long i1, i2;            /* One word from each buffer to compare. */
  606. @@ -430,7 +451,7 @@
  607.  
  608.     Return the offset of the first byte that differs.  */
  609.  
  610. -int
  611. +static int
  612.  block_compare (p1, p2)
  613.       char *p1, *p2;
  614.  {
  615. @@ -454,7 +475,7 @@
  616.  /* Read NCHARS bytes from descriptor FD into BUF.
  617.     Return the number of characters successfully read.  */
  618.  
  619. -int
  620. +static int
  621.  block_read (fd, buf, nchars)
  622.       int fd;
  623.       char *buf;
  624. @@ -480,7 +501,7 @@
  625.     visible by quoting like cat -t does.
  626.     Pad with spaces on the right to WIDTH characters.  */
  627.  
  628. -void
  629. +static void
  630.  printc (fs, width, c)
  631.       FILE *fs;
  632.       int width;
  633. @@ -510,3 +531,21 @@
  634.    while (--width > 0)
  635.      putc (' ', fs);
  636.  }
  637. +
  638. +#ifdef AMIGA
  639. +static void fake_stat_result (sbuf)
  640. +     struct stat *sbuf;
  641. +{
  642. +  time_t cur_time;
  643. +
  644. +  time (&cur_time);
  645. +  sbuf->st_dev = 0;
  646. +  sbuf->st_ino = 0;
  647. +  sbuf->st_mode = S_IREAD;
  648. +  sbuf->st_nlink = 1;
  649. +  sbuf->st_uid = 0;
  650. +  sbuf->st_gid = 0;
  651. +  sbuf->st_size = 0;
  652. +  sbuf->st_ctime = sbuf->st_atime = sbuf->st_mtime = cur_time;
  653. +}
  654. +#endif /* AMIGA */
  655. --- Diff22:regex.c    Wed Jan 06 19:47:10 1993
  656. +++ regex.c    Sun Apr 04 19:40:56 1993
  657. @@ -90,6 +90,10 @@
  658.  
  659.  static char re_syntax_table[CHAR_SET_SIZE];
  660.  
  661. +#ifdef KULTUR
  662. +static void init_syntax_once (void);
  663. +#endif
  664. +
  665.  static void
  666.  init_syntax_once ()
  667.  {
  668. @@ -124,6 +128,62 @@
  669.  /* Get the interface, including the syntax bits.  */
  670.  #include "regex.h"
  671.  
  672. +#ifdef KULTUR
  673. +#define register
  674. +void *alloca (unsigned);
  675. +#define MATCH_NULL_UNSET_VALUE 3
  676. +typedef unsigned regnum_t;
  677. +typedef const unsigned char *fail_stack_elt_t;
  678. +typedef union { fail_stack_elt_t word; struct { unsigned match_null_string_p :
  679. +2; unsigned is_active : 1; unsigned matched_something : 1; unsigned
  680. +ever_matched_something : 1; } bits; } register_info_type;
  681. +typedef int pattern_offset_t;
  682. +typedef struct { pattern_offset_t begalt_offset; pattern_offset_t
  683. +fixup_alt_jump; pattern_offset_t inner_group_offset; pattern_offset_t
  684. +laststart_offset; regnum_t regnum; } compile_stack_elt_t;
  685. +typedef struct { compile_stack_elt_t *stack; unsigned size; unsigned avail; }
  686. +compile_stack_type;
  687. +typedef enum { no_op = 0, exactn = 1, anychar, charset, charset_not,
  688. +start_memory, stop_memory, duplicate, begline, endline, begbuf, endbuf, jump,
  689. +jump_past_alt, on_failure_jump, on_failure_keep_string_jump, pop_failure_jump,
  690. +maybe_pop_jump, dummy_failure_jump, push_dummy_failure, succeed_n, jump_n,
  691. +set_number_at, wordchar, notwordchar, wordbeg, wordend, wordbound, notwordbound
  692. +} re_opcode_t;
  693. +typedef char boolean;
  694. +static void init_syntax_once (void);
  695. +void print_fastmap (char *);
  696. +void print_partial_compiled_pattern (unsigned char *, unsigned char *);
  697. +void print_compiled_pattern (struct re_pattern_buffer *);
  698. +void print_double_string (const char *, const char *, const char *, int, int);
  699. +reg_syntax_t re_set_syntax (reg_syntax_t);
  700. +static reg_errcode_t regex_compile (const char *, int, reg_syntax_t, struct re_pattern_buffer *);
  701. +static void store_op1 (re_opcode_t, unsigned char *, int);
  702. +static void store_op2 (re_opcode_t, unsigned char *, int, int);
  703. +static void insert_op1 (re_opcode_t, unsigned char *, int, unsigned char *);    
  704. +static void insert_op2 (re_opcode_t, unsigned char *, int, int, unsigned char *);
  705. +static boolean at_begline_loc_p (const char *, const char *, reg_syntax_t);
  706. +static boolean at_endline_loc_p  (const char *, const char *, int);
  707. +static boolean group_in_compile_stack (compile_stack_type, regnum_t);
  708. +static reg_errcode_t compile_range (const char **, const char *, char *, reg_syntax_t, unsigned char *);
  709. +int re_compile_fastmap (struct re_pattern_buffer *);
  710. +void re_set_registers (struct re_pattern_buffer *, struct re_registers *, unsigned, regoff_t *, regoff_t *);
  711. +int re_search (struct re_pattern_buffer *, const char *, int, int, int, struct re_registers *);
  712. +int re_search_2 (struct re_pattern_buffer *, const char *, int, const char *, int, int, int, struct re_registers *, int);
  713. +int re_match (struct re_pattern_buffer *, const char *, int, int, struct re_registers *);
  714. +int re_match_2 (struct re_pattern_buffer *, const char *, int, const char *, int, int, struct re_registers *, int);
  715. +static boolean group_match_null_string_p (unsigned char **, unsigned char *, register_info_type *);
  716. +static boolean alt_match_null_string_p (unsigned char *, unsigned char *, register_info_type *);
  717. +static boolean common_op_match_null_string_p (unsigned char **, unsigned char *, register_info_type *);
  718. +static int bcmp_translate (unsigned char *, unsigned char *, int, char *);
  719. +const char *re_compile_pattern (const char *, int, struct re_pattern_buffer *);
  720. +char *re_comp (const char *);
  721. +int re_exec (const char *);
  722. +int regcomp (regex_t *, const char *, int);
  723. +int regexec (const regex_t *, const char *, size_t, regmatch_t [], int);
  724. +/* size_t regerror (int, const regex_t *, char *, size_t); */
  725. +void regfree (regex_t *);
  726. +#endif
  727. +
  728.  /* isalpha etc. are used for the character classes.  */
  729.  #include <ctype.h>
  730.  
  731. @@ -197,7 +257,11 @@
  732.  #include <alloca.h>
  733.  #else /* not __GNUC__ or HAVE_ALLOCA_H */
  734.  #ifndef _AIX /* Already did AIX, up at the top.  */
  735. +#ifdef KULTUR
  736. +void *alloca (unsigned);
  737. +#else
  738.  char *alloca ();
  739. +#endif
  740.  #endif /* not _AIX */
  741.  #endif /* not HAVE_ALLOCA_H */ 
  742.  #endif /* not __GNUC__ */
  743. @@ -207,10 +271,17 @@
  744.  #define REGEX_ALLOCATE alloca
  745.  
  746.  /* Assumes a `char *destination' variable.  */
  747. +#ifdef KULTUR
  748. +#define REGEX_REALLOCATE(source, osize, nsize)                \
  749. +  (destination = (char *) alloca (nsize),                \
  750. +   bcopy ((const void *)source, (void *)destination, (size_t) osize),    \
  751. +   destination)
  752. +#else
  753.  #define REGEX_REALLOCATE(source, osize, nsize)                \
  754.    (destination = (char *) alloca (nsize),                \
  755.     bcopy (source, destination, osize),                    \
  756.     destination)
  757. +#endif
  758.  
  759.  #endif /* not REGEX_MALLOC */
  760.  
  761. @@ -233,7 +304,9 @@
  762.  #define MAX(a, b) ((a) > (b) ? (a) : (b))
  763.  #define MIN(a, b) ((a) < (b) ? (a) : (b))
  764.  
  765. +#ifndef KULTUR
  766.  typedef char boolean;
  767. +#endif
  768.  #define false 0
  769.  #define true 1
  770.  
  771. @@ -246,6 +319,7 @@
  772.     So regex.h defines a symbol `RE_EXACTN_VALUE' to be 1; the value of
  773.     `exactn' we use here must also be 1.  */
  774.  
  775. +#ifndef KULTUR
  776.  typedef enum
  777.  {
  778.    no_op = 0,
  779. @@ -376,6 +450,7 @@
  780.    notsyntaxspec
  781.  #endif /* emacs */
  782.  } re_opcode_t;
  783. +#endif
  784.  
  785.  /* Common operations on the compiled pattern.  */
  786.  
  787. @@ -839,11 +914,13 @@
  788.  
  789.  /* Subroutine declarations and macros for regex_compile.  */
  790.  
  791. +#ifndef KULTUR
  792.  static void store_op1 (), store_op2 ();
  793.  static void insert_op1 (), insert_op2 ();
  794.  static boolean at_begline_loc_p (), at_endline_loc_p ();
  795.  static boolean group_in_compile_stack ();
  796.  static reg_errcode_t compile_range ();
  797. +#endif
  798.  
  799.  /* Fetch the next character in the uncompiled pattern---translating it 
  800.     if necessary.  Also cast from a signed character in the constant
  801. @@ -946,7 +1023,7 @@
  802.      bufp->allocated <<= 1;                        \
  803.      if (bufp->allocated > MAX_BUF_SIZE)                    \
  804.        bufp->allocated = MAX_BUF_SIZE;                     \
  805. -    bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\
  806. +    bufp->buffer = (unsigned char *) realloc (bufp->buffer, (size_t) bufp->allocated);\
  807.      if (bufp->buffer == NULL)                        \
  808.        return REG_ESPACE;                        \
  809.      /* If the buffer moved, move all the pointers into it.  */        \
  810. @@ -971,13 +1048,16 @@
  811.  
  812.  /* But patterns can have more than `MAX_REGNUM' registers.  We just
  813.     ignore the excess.  */
  814. +#ifndef KULTUR
  815.  typedef unsigned regnum_t;
  816. +#endif
  817.  
  818.  
  819.  /* Macros for the compile stack.  */
  820.  
  821.  /* Since offsets can go either forwards or backwards, this type needs to
  822.     be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1.  */
  823. +#ifndef KULTUR
  824.  typedef int pattern_offset_t;
  825.  
  826.  typedef struct
  827. @@ -996,7 +1076,7 @@
  828.    unsigned size;
  829.    unsigned avail;            /* Offset of next open position.  */
  830.  } compile_stack_type;
  831. -
  832. +#endif
  833.  
  834.  #define INIT_COMPILE_STACK_SIZE 32
  835.  
  836. @@ -2126,11 +2206,11 @@
  837.    const char *prev = p - 2;
  838.    boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
  839.    
  840. -  return
  841. +  return (boolean)(
  842.         /* After a subexpression?  */
  843.         (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
  844.         /* After an alternative?  */
  845. -    || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
  846. +    || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash)));
  847.  }
  848.  
  849.  
  850. @@ -2146,13 +2226,13 @@
  851.    boolean next_backslash = *next == '\\';
  852.    const char *next_next = p + 1 < pend ? p + 1 : NULL;
  853.    
  854. -  return
  855. +  return (boolean)(
  856.         /* Before a subexpression?  */
  857.         (syntax & RE_NO_BK_PARENS ? *next == ')'
  858.          : next_backslash && next_next && *next_next == ')')
  859.         /* Before an alternative?  */
  860.      || (syntax & RE_NO_BK_VBAR ? *next == '|'
  861. -        : next_backslash && next_next && *next_next == '|');
  862. +        : next_backslash && next_next && *next_next == '|'));
  863.  }
  864.  
  865.  
  866. @@ -2250,7 +2330,9 @@
  867.     change it ourselves.  */
  868.  int re_max_failures = 2000;
  869.  
  870. +#ifndef KULTUR
  871.  typedef const unsigned char *fail_stack_elt_t;
  872. +#endif
  873.  
  874.  typedef struct
  875.  {
  876. @@ -2449,7 +2531,7 @@
  877.     Also assumes the variables `fail_stack' and (if debugging), `bufp',
  878.     `pend', `string1', `size1', `string2', and `size2'.  */
  879.  
  880. -#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
  881. +#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info) \
  882.  {                                    \
  883.    DEBUG_STATEMENT (fail_stack_elt_t failure_id;)            \
  884.    int this_reg;                                \
  885. @@ -2981,6 +3063,7 @@
  886.  
  887.  /* Declarations and macros for re_match_2.  */
  888.  
  889. +#ifndef KULTUR
  890.  static int bcmp_translate ();
  891.  static boolean alt_match_null_string_p (),
  892.                 common_op_match_null_string_p (),
  893. @@ -3011,6 +3094,7 @@
  894.      unsigned ever_matched_something : 1;
  895.    } bits;
  896.  } register_info_type;
  897. +#endif
  898.  
  899.  #define REG_MATCH_NULL_STRING_P(R)  ((R).bits.match_null_string_p)
  900.  #define IS_ACTIVE(R)  ((R).bits.is_active)
  901. @@ -3822,7 +3906,11 @@
  902.          /* Compare that many; failure if mismatch, else move
  903.                     past them.  */
  904.          if (translate 
  905. +#ifdef KULTUR
  906. +                    ? bcmp_translate ((unsigned char *) d, (unsigned char *) d2, mcnt, translate) 
  907. +#else
  908.                      ? bcmp_translate (d, d2, mcnt, translate) 
  909. +#endif
  910.                      : bcmp (d, d2, mcnt))
  911.            goto fail;
  912.          d += mcnt, d2 += mcnt;
  913. @@ -4862,6 +4950,7 @@
  914.  /* Returns a message corresponding to an error code, ERRCODE, returned
  915.     from either regcomp or regexec.   We don't use PREG here.  */
  916.  
  917. +#ifdef INCLUDE_ALL_STUPID_FUNCTIONS
  918.  size_t
  919.  regerror (errcode, preg, errbuf, errbuf_size)
  920.      int errcode;
  921. @@ -4895,7 +4984,7 @@
  922.  
  923.    return msg_size;
  924.  }
  925. -
  926. +#endif
  927.  
  928.  /* Free dynamically allocated space used by PREG.  */
  929.  
  930. --- Diff22:analyze.c    Wed Sep 30 03:21:58 1992
  931. +++ analyze.c    Sun Apr 04 19:38:46 1993
  932. @@ -23,6 +23,15 @@
  933.  
  934.  #include "diff.h"
  935.  
  936. +#ifdef KULTUR
  937. +static int diag (int, int, int, int, int *);
  938. +static struct change *add_change (int, int, int, int, struct change *);
  939. +static struct change *build_reverse_script (struct file_data []);
  940. +static struct change *build_script (struct file_data []);
  941. +static void compareseq (int, int, int, int);
  942. +static void discard_confusing_lines (struct file_data []);
  943. +static void shift_boundaries (struct file_data []);
  944. +#else
  945.  int read_files ();
  946.  void finish_output ();
  947.  void print_context_script ();
  948. @@ -33,6 +42,7 @@
  949.  void print_rcs_script ();
  950.  void pr_forward_ed_script ();
  951.  void setup_output ();
  952. +#endif
  953.  
  954.  extern int no_discards;
  955.  
  956. @@ -259,12 +269,18 @@
  957.        files[0].changed_flag[files[0].realindexes[xoff++]] = 1;
  958.    else
  959.      {
  960. +#ifdef KULTUR
  961. +      int c, d, b;
  962. +#else
  963.        int c, d, f, b;
  964. +#endif
  965.  
  966.        /* Find a point of correspondence in the middle of the files.  */
  967.  
  968.        d = diag (xoff, xlim, yoff, ylim, &c);
  969. +#ifndef KULTUR
  970.        f = fdiag[d];
  971. +#endif
  972.        b = bdiag[d];
  973.  
  974.        if (c == 1)
  975. @@ -308,7 +324,7 @@
  976.     When we discard a line, we also mark it as a deletion or insertion
  977.     so that it will be printed in the output.  */
  978.  
  979. -void
  980. +static void
  981.  discard_confusing_lines (filevec)
  982.       struct file_data filevec[];
  983.  {
  984. @@ -919,7 +935,11 @@
  985.      free (filevec[i].equivs);
  986.  
  987.        for (i = 0; i < 2; ++i)
  988. +#ifdef KULTUR
  989. +    free ((VOID *) (filevec[i].linbuf + filevec[i].linbuf_base));
  990. +#else
  991.      free (filevec[i].linbuf + filevec[i].linbuf_base);
  992. +#endif
  993.  
  994.        for (e = script; e; e = p)
  995.      {
  996. --- Diff22:alloca.c    Tue Dec 01 12:25:52 1992
  997. +++ alloca.c    Sun Apr 04 20:33:39 1993
  998. @@ -58,8 +58,15 @@
  999.  
  1000.  #define    NULL    0            /* null pointer constant */
  1001.  
  1002. +#ifdef KULTUR
  1003. +static void find_stack_direction (void);
  1004. +pointer alloca (unsigned size);
  1005. +extern void free (pointer);
  1006. +extern pointer xmalloc (unsigned);
  1007. +#else
  1008.  extern void    free();
  1009.  extern pointer    xmalloc();
  1010. +#endif
  1011.  
  1012.  /*
  1013.      Define STACK_DIRECTION if you know the direction of stack
  1014. --- Diff22:fnmatch.c    Wed Nov 18 13:24:16 1992
  1015. +++ fnmatch.c    Sun Apr 04 20:32:32 1993
  1016. @@ -16,7 +16,11 @@
  1017.  Cambridge, MA 02139, USA.  */
  1018.  
  1019.  #include <errno.h>
  1020. +#ifdef __SASC_60
  1021. +#include "fnmatch.h"
  1022. +#else
  1023.  #include <fnmatch.h>
  1024. +#endif
  1025.  
  1026.  #if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
  1027.  extern int errno;
  1028. --- Diff22:diff.h    Wed Sep 30 03:21:58 1992
  1029. +++ diff.h    Sun Apr 04 19:39:16 1993
  1030. @@ -306,6 +306,10 @@
  1031.  #else
  1032.  #define VOID char
  1033.  #endif
  1034. +
  1035. +#ifdef KULTUR
  1036. +#include "Diff_Protos.h"
  1037. +#else
  1038.  VOID *xmalloc ();
  1039.  VOID *xrealloc ();
  1040.  char *concat ();
  1041. @@ -330,3 +334,4 @@
  1042.  void print_script ();
  1043.  void slurp ();
  1044.  void translate_range ();
  1045. +#endif
  1046. --- Diff22:xmalloc.c    Sat Jul 18 12:27:22 1992
  1047. +++ xmalloc.c    Sun Apr 04 19:41:26 1993
  1048. @@ -23,11 +23,21 @@
  1049.  void free ();
  1050.  #endif
  1051.  
  1052. +#ifdef KULTUR
  1053. +void error (int, int, char *, ...);
  1054. +void *xmalloc (unsigned n);
  1055. +void *xrealloc (void *p, unsigned n);
  1056. +#else
  1057.  void error ();
  1058. +#endif
  1059.  
  1060.  /* Allocate N bytes of memory dynamically, with error checking.  */
  1061.  
  1062. +#ifdef KULTUR
  1063. +void *
  1064. +#else
  1065.  char *
  1066. +#endif
  1067.  xmalloc (n)
  1068.       unsigned n;
  1069.  {
  1070. @@ -45,10 +55,14 @@
  1071.     If P is NULL, run xmalloc.
  1072.     If N is 0, run free and return NULL.  */
  1073.  
  1074. +#ifdef KULTUR
  1075. +void *xrealloc (void *p, unsigned n)
  1076. +#else
  1077.  char *
  1078.  xrealloc (p, n)
  1079.       char *p;
  1080.       unsigned n;
  1081. +#endif
  1082.  {
  1083.    if (p == 0)
  1084.      return xmalloc (n);
  1085. --- Diff22:util.c    Thu Nov 12 10:02:18 1992
  1086. +++ util.c    Sun Apr 04 19:41:22 1993
  1087. @@ -19,6 +19,27 @@
  1088.  
  1089.  #include "diff.h"
  1090.  
  1091. +#ifdef KULTUR
  1092. +static void debug_script (struct change *sp);
  1093. +#endif
  1094. +
  1095. +#ifdef AMIGA
  1096. +#include <signal.h>
  1097. +#ifdef KULTUR
  1098. +#pragma msg 149 ignore push
  1099. +#endif
  1100. +#include <exec/types.h>
  1101. +#include <dos/dostags.h>
  1102. +#include <proto/dos.h>
  1103. +#include <proto/exec.h>
  1104. +#ifdef KULTUR
  1105. +#pragma msg 149 pop
  1106. +#endif
  1107. +
  1108. +extern struct DosLibrary *DOSBase;
  1109. +static char tmpfilename[L_tmpnam];
  1110. +#endif /* AMIGA */
  1111. +
  1112.  /* Use when a system call returns non-zero status.
  1113.     TEXT should normally be the file name.  */
  1114.  
  1115. @@ -154,6 +175,7 @@
  1116.    strcat (name, current_name1);
  1117.  
  1118.    if (paginate_flag)
  1119. +#ifndef AMIGA
  1120.      {
  1121.        int pipes[2];
  1122.        int desc;
  1123. @@ -187,6 +209,26 @@
  1124.        outfile = fdopen (pipes[1], "w");
  1125.      } 
  1126.      }
  1127. +#else /* AMIGA */
  1128. +    {
  1129. +      if (DOSBase->dl_lib.lib_Version < 37)
  1130. +    {
  1131. +      fputs ("Need Amiga OS 2.0 (V.37) to paginate. ", stderr);
  1132. +      fputs ("Using stdout instead.\n", stderr);
  1133. +      outfile = stdout;
  1134. +    }
  1135. +      else
  1136. +    {
  1137. +      /* Output the differences to a file and process the file with
  1138. +       * pr later on. This is a really bad hack (a kluge??? :-) ),
  1139. +       * but I couldn't find something better... */
  1140. +      tmpnam (tmpfilename);
  1141. +      outfile = fopen (tmpfilename, "w");
  1142. +      if (outfile == NULL)
  1143. +        pfatal_with_name ("pipe");
  1144. +    }
  1145. +    }
  1146. +#endif
  1147.    else
  1148.      {
  1149.  
  1150. @@ -225,10 +267,64 @@
  1151.  finish_output ()
  1152.  {
  1153.    if (outfile != 0 && outfile != stdout)
  1154. +#ifndef AMIGA
  1155.      {
  1156.        fclose (outfile);
  1157.        wait (0);
  1158.      }
  1159. +#else /* AMIGA */
  1160. +    {
  1161. +      char *command_line;
  1162. +      struct TagItem STags[5];
  1163. +      BPTR StdInPr;
  1164. +
  1165. +      /* Close the temporary file and run pr with this file as input */
  1166. +      fclose (outfile);
  1167. +      command_line = (char *) xmalloc (strlen (current_name0)
  1168. +                       + strlen (current_name1)
  1169. +                       + strlen (switch_string) + 30);
  1170. +      strcpy (command_line, "pr -f -h \"");
  1171. +      strcat (command_line, "diff");
  1172. +      strcat (command_line, switch_string);
  1173. +      strcat (command_line, " ");
  1174. +      strcat (command_line, current_name0);
  1175. +      strcat (command_line, " ");
  1176. +      strcat (command_line, current_name1);
  1177. +      strcat (command_line, "\"");
  1178. +      StdInPr = Open (tmpfilename, MODE_OLDFILE);
  1179. +      if (StdInPr == NULL)
  1180. +    pfatal_with_name ("pipe");
  1181. +#ifdef KULTUR
  1182. +      STags[0].ti_Tag = (Tag) SYS_Input;
  1183. +      STags[0].ti_Data = StdInPr;
  1184. +      STags[1].ti_Tag = (Tag) SYS_Output;
  1185. +      STags[1].ti_Data = Output ();
  1186. +      STags[2].ti_Tag = (Tag) SYS_Asynch;
  1187. +      STags[2].ti_Data = FALSE;
  1188. +      STags[3].ti_Tag = (Tag) SYS_UserShell;
  1189. +      STags[3].ti_Data = TRUE;
  1190. +      STags[4].ti_Tag = TAG_DONE;
  1191. +#else
  1192. +      STags[0].ti_Tag = SYS_Input;
  1193. +      STags[0].ti_Data = StdInPr;
  1194. +      STags[1].ti_Tag = SYS_Output;
  1195. +      STags[1].ti_Data = Output ();
  1196. +      STags[2].ti_Tag = SYS_Asynch;
  1197. +      STags[2].ti_Data = FALSE;
  1198. +      STags[3].ti_Tag = SYS_UserShell;
  1199. +      STags[3].ti_Data = TRUE;
  1200. +      STags[4].ti_Tag = TAG_DONE;
  1201. +#endif
  1202. +      if (System (command_line, STags) != 0)
  1203. +    {
  1204. +      Close (StdInPr);
  1205. +      DeleteFile (tmpfilename);
  1206. +      pfatal_with_name ("pr");
  1207. +    }
  1208. +      Close (StdInPr);
  1209. +      DeleteFile (tmpfilename);
  1210. +    }
  1211. +#endif /* !AMIGA */
  1212.  
  1213.    outfile = 0;
  1214.  }
  1215. @@ -364,8 +460,13 @@
  1216.  void
  1217.  print_script (script, hunkfun, printfun)
  1218.       struct change *script;
  1219. +#ifdef KULTUR
  1220. +     struct change * (*hunkfun) (struct change *);
  1221. +     void (*printfun) (struct change *);
  1222. +#else
  1223.       struct change * (*hunkfun) ();
  1224.       void (*printfun) ();
  1225. +#endif
  1226.  {
  1227.    struct change *next = script;
  1228.  
  1229. @@ -480,7 +581,11 @@
  1230.      }
  1231.  }
  1232.  
  1233. +#ifdef KULTUR
  1234. +char
  1235. +#else
  1236.  int
  1237. +#endif
  1238.  change_letter (inserts, deletes)
  1239.       int inserts, deletes;
  1240.  {
  1241. @@ -523,11 +628,16 @@
  1242.     Args A and B are internal line numbers.
  1243.     We print the translated (real) line numbers.  */
  1244.  
  1245. +#ifdef KULTUR
  1246. +void
  1247. +print_number_range (char sepchar, struct file_data *file, int a, int b)
  1248. +#else
  1249.  void
  1250.  print_number_range (sepchar, file, a, b)
  1251.       char sepchar;
  1252.       struct file_data *file;
  1253.       int a, b;
  1254. +#endif
  1255.  {
  1256.    int trans_a, trans_b;
  1257.    translate_range (file, a, b, &trans_a, &trans_b);
  1258. @@ -676,7 +786,7 @@
  1259.    return new;
  1260.  }
  1261.  
  1262. -void
  1263. +static void
  1264.  debug_script (sp)
  1265.       struct change *sp;
  1266.  {
  1267. --- Diff22:side.c    Sat Jan 30 20:49:14 1993
  1268. +++ side.c    Sun Apr 04 19:41:09 1993
  1269. @@ -18,13 +18,19 @@
  1270.  file named COPYING.  Among other things, the copyright notice
  1271.  and this notice must be preserved on all copies.  */
  1272.  
  1273. -
  1274.  #include "diff.h"
  1275.  
  1276. -
  1277. +#ifdef KULTUR
  1278. +static unsigned tab_from_to (unsigned from, unsigned to);
  1279. +static unsigned print_half_line (const char * const *line, unsigned indent, unsigned out_bound);
  1280. +static void print_1sdiff_line (const char * const *left, int sep, const char * const *right);
  1281. +static void print_sdiff_common_lines (int limit0, int limit1);
  1282. +static void print_sdiff_hunk (struct change *hunk);
  1283. +#else
  1284.  static void print_sdiff_hunk ();
  1285.  static void print_sdiff_common_lines ();
  1286.  static void print_1sdiff_line ();
  1287. +#endif
  1288.  
  1289.  /* Next line number to be printed in the two input files.  */
  1290.  static int next0, next1;
  1291. --- Diff22:sdiff.c    Thu Feb 11 02:39:42 1993
  1292. +++ sdiff.c    Sun Apr 04 20:34:58 1993
  1293. @@ -25,10 +25,30 @@
  1294.  #include <signal.h>
  1295.  #include "getopt.h"
  1296.  
  1297. +#ifdef AMIGA
  1298. +#ifdef KULTUR
  1299. +#pragma msg 149 ignore push
  1300. +#endif
  1301. +#include <exec/types.h>
  1302. +#include <dos/dostags.h>
  1303. +#include <proto/exec.h>
  1304. +#include <proto/dos.h>
  1305. +#ifdef KULTUR
  1306. +#pragma msg 149 pop
  1307. +#endif
  1308. +
  1309. +extern struct DosLibrary *DOSBase;
  1310. +#endif /* AMIGA */
  1311. +
  1312.  #ifndef SEEK_SET
  1313.  #define SEEK_SET 0
  1314.  #endif
  1315.  
  1316. +#ifdef KULTUR
  1317. +#define DIFF_PROGRAM "diff"
  1318. +#define DEFAULT_EDITOR "ed -sticky"
  1319. +#endif
  1320. +
  1321.  /* Size of chunks read from files which must be parsed into lines. */
  1322.  #define SDIFF_BUFSIZE 65536
  1323.  
  1324. @@ -49,8 +69,56 @@
  1325.  
  1326.  static char *tmpname;
  1327.  static int volatile tmpmade;
  1328. +#ifndef AMIGA
  1329.  static pid_t volatile diffpid;
  1330. +#endif /* !AMIGA */
  1331. +
  1332. +#ifdef KULTUR
  1333. +#include <dos.h>
  1334. +extern int onbreak(int (*)(void));
  1335. +extern FILE *fdopen(int, const char *);
  1336. +struct line_filter {
  1337. +  FILE *infile;
  1338. +  char *bufpos;
  1339. +  char *buffer;
  1340. +  char *buflim;
  1341. +};
  1342. +char *xmalloc (unsigned);
  1343. +static char command_line[512];
  1344. +static FILE *diff_file = NULL;
  1345. +static int user_quit = 0;
  1346.  
  1347. +static char const *expand_name (char *, int, char const *);
  1348. +static FILE *ck_fdopen (int, char *);
  1349. +static FILE *ck_fopen (char *, char *);
  1350. +static int amiga_break (void);
  1351. +static int diraccess (const char *);
  1352. +static int edit (struct line_filter *, int, struct line_filter *, int, FILE *);
  1353. +static int exists (const char *);
  1354. +static int interact (struct line_filter *, struct line_filter *, struct line_filter *, FILE *);
  1355. +static int lf_snarf (struct line_filter *, char *, size_t);
  1356. +static int skip_white (void);
  1357. +static size_t ck_fread (char *, size_t, FILE *);
  1358. +static size_t lf_refill (struct line_filter *);
  1359. +static void amiga_exit (void);
  1360. +static void ck_fclose (FILE *);
  1361. +static void ck_fflush (FILE *);
  1362. +static void ck_fwrite (char *, size_t, FILE *);
  1363. +static void cleanup (void);
  1364. +static void construct_command_line (char *, char **, char *);
  1365. +static void construct_pipe_name (char *);
  1366. +static void diffarg (char *);
  1367. +static void execdiff (int, char *, char *, char *, long, BPTR);
  1368. +static void exiterr (void);
  1369. +static void fatal (char *);
  1370. +static void flush_line (void);
  1371. +static void give_help (void);
  1372. +static void lf_copy (struct line_filter *, int, FILE *);
  1373. +static void lf_init (struct line_filter *, FILE *);
  1374. +static void lf_skip (struct line_filter *, int);
  1375. +static void perror_fatal (char *);
  1376. +static void usage (void);
  1377. +#else
  1378.  struct line_filter;
  1379.  static void diffarg (); /* (char *); */
  1380.  static void execdiff (); /* (int, char const *, char const *, char const *); */
  1381. @@ -65,6 +133,7 @@
  1382.  #define PVT_tmpdir "/tmp"
  1383.  static char *private_tempnam (); /* (const char *, const char *, int, int *); */
  1384.  static int diraccess ();
  1385. +#endif
  1386.  
  1387.  /* Options: */
  1388.  
  1389. @@ -108,13 +177,54 @@
  1390.    exit (2);
  1391.  }
  1392.  
  1393. +#ifdef AMIGA
  1394. +static void
  1395. +amiga_exit ()
  1396. +{
  1397. +  char *buf;
  1398. +  size_t a;
  1399. +
  1400. +  if (tmpmade)
  1401. +    {
  1402. +      remove (tmpname);
  1403. +      tmpmade = 0;
  1404. +    }
  1405. +  if (diff_file)
  1406. +    {
  1407. +      /* Provide empty pipe! */
  1408. +      buf = xmalloc (SDIFF_BUFSIZE);
  1409. +      do
  1410. +        a = fread (buf, sizeof (char), SDIFF_BUFSIZE, diff_file);
  1411. +      while (a == SDIFF_BUFSIZE);
  1412. +      fclose (diff_file);
  1413. +      diff_file = NULL;
  1414. +      free (buf);
  1415. +    }
  1416. +}
  1417. +
  1418. +static int
  1419. +amiga_break ()
  1420. +{
  1421. +  amiga_exit ();
  1422. +  return 20;
  1423. +}
  1424. +#endif /* AMIGA */
  1425. +
  1426.  static void
  1427.  cleanup ()
  1428.  {
  1429. +#ifndef AMIGA
  1430.    if (0 < diffpid)
  1431.      kill (diffpid, SIGPIPE);
  1432.    if (tmpmade)
  1433.      unlink (tmpname);
  1434. +#else /* AMIGA */
  1435. +  if (tmpmade)
  1436. +    {
  1437. +      remove (tmpname);
  1438. +      tmpmade = 0;
  1439. +    }
  1440. +#endif /* !AMIGA */
  1441.  }
  1442.  
  1443.  static void
  1444. @@ -230,6 +340,7 @@
  1445.  }
  1446.  #endif
  1447.  
  1448. +#ifndef AMIGA
  1449.  #ifndef HAVE_WAITPID
  1450.  /* Emulate waitpid well enough for sdiff, which has at most two children.  */
  1451.  static pid_t
  1452. @@ -259,6 +370,7 @@
  1453.    return pid;
  1454.  }
  1455.  #endif
  1456. +#endif /* !AMIGA */
  1457.  
  1458.  static char const *
  1459.  expand_name (name, isdir, other_name)
  1460. @@ -273,6 +385,7 @@
  1461.    else
  1462.      {
  1463.        /* Yield NAME/BASE, where BASE is OTHER_NAME's basename.  */
  1464. +#ifndef AMIGA
  1465.        const char
  1466.      *p = rindex (other_name, '/'),
  1467.      *base = p ? p+1 : other_name;
  1468. @@ -282,17 +395,45 @@
  1469.        r[namelen] = '/';
  1470.        bcopy (base, r + namelen + 1, baselen + 1);
  1471.        return r;
  1472. +#else /* AMIGA */
  1473. +      const char *p1, *p2, *base;
  1474. +      size_t namelen, baselen;
  1475. +      char *r;
  1476. +
  1477. +      p1 = rindex (other_name, '/');
  1478. +      p2 = rindex (other_name, ':');
  1479. +      if (p1 == NULL && p2 == NULL)
  1480. +        base = other_name;
  1481. +      else
  1482. +        base = max (p1 + 1 , p2 + 1);
  1483. +      namelen = strlen (name);
  1484. +      baselen = strlen (base);
  1485. +      r = xmalloc (namelen + baselen + 2);
  1486. +      bcopy (name, r, namelen);
  1487. +      if (name[namelen-1] != ':')
  1488. +        {
  1489. +          r[namelen] = '/';
  1490. +          bcopy (base, r + namelen + 1, baselen + 1);
  1491. +        }
  1492. +      else
  1493. +        {
  1494. +          bcopy (base, r + namelen, baselen + 1);
  1495. +        }
  1496. +      return r;
  1497. +#endif /* AMIGA */
  1498.      }
  1499.  }
  1500.  
  1501.  
  1502.  
  1503. +#ifndef KULTUR
  1504.  struct line_filter {
  1505.    FILE *infile;
  1506.    char *bufpos;
  1507.    char *buffer;
  1508.    char *buflim;
  1509.  };
  1510. +#endif
  1511.  
  1512.  static void
  1513.  lf_init (lf, infile)
  1514. @@ -409,6 +550,18 @@
  1515.    char *editor = getenv ("EDITOR");
  1516.    char *differ = getenv ("DIFF");
  1517.  
  1518. +#ifdef AMIGA
  1519. +  if (DOSBase->dl_lib.lib_Version < 37) {
  1520. +    fputs ("Need Amiga OS 2.0 (V.37) to execute.\n", stderr);
  1521. +    exit (20);
  1522. +  }
  1523. +  /* Install break and exit traps */
  1524. +  if (atexit (&amiga_exit))
  1525. +    fatal ("couldn't set exit trap");
  1526. +  if (onbreak (&amiga_break))
  1527. +    fatal ("couldn't set break trap");
  1528. +#endif /* AMIGA */
  1529. +
  1530.    prog = argv[0];
  1531.    if (editor)
  1532.      edbin = editor;
  1533. @@ -496,13 +649,19 @@
  1534.  
  1535.    if (! out_file)
  1536.      /* easy case: diff does everything for us */
  1537. +#ifndef AMIGA
  1538.      execdiff (suppress_common_flag, "-y", argv[optind], argv[optind + 1]);
  1539. +#else /* AMIGA */
  1540. +    execdiff (suppress_common_flag, "-y", argv[optind], argv[optind + 1], FALSE, NULL);
  1541. +#endif /* !AMIGA */
  1542.    else
  1543.      {
  1544.        FILE *left, *right, *out, *diffout;
  1545.        int diff_fds[2];
  1546.        int interact_ok;
  1547. +#ifndef AMIGA
  1548.        pid_t pid;
  1549. +#endif
  1550.        struct line_filter lfilt;
  1551.        struct line_filter rfilt;
  1552.        struct line_filter diff_filt;
  1553. @@ -512,11 +671,13 @@
  1554.        if (leftdir && rightdir)
  1555.      fatal ("both files to be compared are directories");
  1556.  
  1557. -      left = ck_fopen (expand_name (argv[optind], leftdir, argv[optind + 1]), "r");
  1558. +      left = ck_fopen ((char *) expand_name (argv[optind], leftdir, argv[optind + 1]), "r");
  1559.        ;
  1560. -      right = ck_fopen (expand_name (argv[optind + 1], rightdir, argv[optind]), "r");
  1561. +      right = ck_fopen ((char *) expand_name (argv[optind + 1], rightdir, argv[optind]), "r");
  1562.        out = ck_fopen (out_file, "w");
  1563.  
  1564. +#ifndef AMIGA
  1565. +
  1566.        if (pipe (diff_fds))
  1567.      perror_fatal ("pipe");
  1568.  
  1569. @@ -545,18 +706,51 @@
  1570.        close (diff_fds[1]);
  1571.        diffout = ck_fdopen (diff_fds[0], "r");
  1572.  
  1573. +#else /* AMIGA */
  1574. +
  1575. +      {
  1576. +        BPTR StdOutDiff;
  1577. +        char pipe_name[20];
  1578. +
  1579. +        construct_pipe_name (pipe_name);
  1580. +
  1581. +        StdOutDiff = Open (pipe_name, MODE_NEWFILE);
  1582. +        if (!StdOutDiff)
  1583. +          perror_fatal ("pipe");
  1584. +
  1585. +        diff_fds[0] = open (pipe_name, O_RDONLY);
  1586. +        if (diff_fds[0] == -1)
  1587. +          perror_fatal ("pipe");
  1588. +
  1589. +        execdiff (0, "--sdiff-merge-assist", argv[optind], argv[optind + 1], TRUE, StdOutDiff);
  1590. +
  1591. +      }
  1592. +
  1593. +      diffout = ck_fdopen (diff_fds[0], "r");
  1594. +      diff_file = diffout;
  1595. +
  1596. +#endif /* !AMIGA */
  1597. +
  1598.        lf_init (&diff_filt, diffout);
  1599.        lf_init (&lfilt, left);
  1600.        lf_init (&rfilt, right);
  1601.  
  1602.        interact_ok = interact (&diff_filt, &lfilt, &rfilt, out);
  1603.  
  1604. +#ifndef AMIGA
  1605.        ck_fclose (diffout);
  1606. +#else /* AMIGA */
  1607. +      /* If the user signaled quit, let the exit code clean up the
  1608. +         pipe and close the file */
  1609. +      if (!user_quit)
  1610. +        ck_fclose (diffout);
  1611. +#endif /* !AMIGA */
  1612.        ck_fclose (left);
  1613.        ck_fclose (right);
  1614.        ck_fclose (out);
  1615.  
  1616.        {
  1617. +#ifndef AMIGA
  1618.      int wstatus;
  1619.  
  1620.      if (waitpid (pid, &wstatus, 0) < 0)
  1621. @@ -576,6 +770,20 @@
  1622.        fatal ("Subsidiary diff failed");
  1623.  
  1624.      exit (WEXITSTATUS (wstatus));
  1625. +#else /* AMIGA */
  1626. +    if (tmpmade)
  1627. +      {
  1628. +        remove (tmpname);
  1629. +        tmpmade = 0;
  1630. +      }
  1631. +
  1632. +    if (! interact_ok)
  1633. +      exit (2);
  1634. +
  1635. +        diff_file = NULL;
  1636. +
  1637. +        exit (0);
  1638. +#endif /* !AMIGA */
  1639.        }
  1640.      }
  1641.    return 0;            /* Fool -Wall . . . */
  1642. @@ -604,6 +812,8 @@
  1643.    diffargv[diffargs++] = a;
  1644.  }
  1645.  
  1646. +#ifndef AMIGA
  1647. +
  1648.  static void
  1649.  execdiff (differences_only, option, file1, file2)
  1650.       int differences_only;
  1651. @@ -623,9 +833,102 @@
  1652.    _exit (2);
  1653.  }
  1654.  
  1655. -
  1656. +#else /* AMIGA */
  1657. +
  1658. +static void
  1659. +execdiff (differences_only, option, file1, file2, asynch, handle)
  1660. +     int differences_only;
  1661. +     char *option, *file1, *file2;
  1662. +     long asynch;
  1663. +     BPTR handle;
  1664. +{
  1665. +  struct TagItem STags[5];
  1666. +
  1667. +  if (differences_only)
  1668. +    diffarg ("--suppress-common-lines");
  1669. +  diffarg (option);
  1670. +  diffarg ("--");
  1671. +  diffarg (file1);
  1672. +  diffarg (file2);
  1673. +  diffarg (0);
  1674. +
  1675. +  construct_command_line ((char *) diffbin, diffargv, command_line);
  1676. +  if (asynch)
  1677. +    {
  1678. +#ifdef KULTUR
  1679. +      STags[0].ti_Tag = (Tag) SYS_Input;
  1680. +      STags[0].ti_Data = NULL;
  1681. +      STags[1].ti_Tag = (Tag) SYS_Output;
  1682. +      STags[1].ti_Data = handle;
  1683. +      STags[2].ti_Tag = (Tag) SYS_Asynch;
  1684. +      STags[2].ti_Data = TRUE;
  1685. +      STags[3].ti_Tag = (Tag) SYS_UserShell;
  1686. +      STags[3].ti_Data = TRUE;
  1687. +      STags[4].ti_Tag = TAG_DONE;
  1688. +#else
  1689. +      STags[0].ti_Tag = SYS_Input;
  1690. +      STags[0].ti_Data = NULL;
  1691. +      STags[1].ti_Tag = SYS_Output;
  1692. +      STags[1].ti_Data = handle;
  1693. +      STags[2].ti_Tag = SYS_Asynch;
  1694. +      STags[2].ti_Data = TRUE;
  1695. +      STags[3].ti_Tag = SYS_UserShell;
  1696. +      STags[3].ti_Data = TRUE;
  1697. +      STags[4].ti_Tag = TAG_DONE;
  1698. +#endif
  1699. +      if (System (command_line, STags) != 0)
  1700. +        perror_fatal ("diff not found");
  1701. +    }
  1702. +  else
  1703. +    {
  1704. +#ifdef KULTUR
  1705. +      STags[0].ti_Tag = (Tag) SYS_Asynch;
  1706. +      STags[0].ti_Data = FALSE;
  1707. +      STags[1].ti_Tag = (Tag) SYS_UserShell;
  1708. +      STags[1].ti_Data = TRUE;
  1709. +      STags[2].ti_Tag = TAG_DONE;
  1710. +#else
  1711. +      STags[0].ti_Tag = SYS_Asynch;
  1712. +      STags[0].ti_Data = FALSE;
  1713. +      STags[1].ti_Tag = SYS_UserShell;
  1714. +      STags[1].ti_Data = TRUE;
  1715. +      STags[2].ti_Tag = TAG_DONE;
  1716. +#endif
  1717. +      if (System (command_line, STags) != 0)
  1718. +        perror_fatal ("diff not found");
  1719. +      exit (0);
  1720. +    }
  1721. +}
  1722. +
  1723. +static void
  1724. +construct_command_line (binname, argvec, com_line)
  1725. +     char *binname, **argvec, *com_line;
  1726. +{
  1727. +  int i;
  1728. +  strcpy (com_line, binname);
  1729. +  for (i = 1; argvec[i]; i++)
  1730. +    {
  1731. +      /* Enclose arguments in quotes */
  1732. +      strcat (com_line, " \"");
  1733. +      strcat (com_line, argvec[i]);
  1734. +      strcat (com_line, "\"");
  1735. +    }
  1736. +}
  1737. +
  1738. +static void
  1739. +construct_pipe_name (pipe_name)
  1740. +     char *pipe_name;
  1741. +{
  1742. +  static long invocations = 0;
  1743. +  struct Task *Task;
  1744.  
  1745. +  Task = FindTask (NULL);
  1746. +  sprintf (pipe_name, "PIPE:%08lX_%ld", Task, invocations);
  1747. +}
  1748.  
  1749. +#endif /* !AMIGA */
  1750. +
  1751. +#ifndef AMIGA
  1752.  /* Signal handling */
  1753.  
  1754.  static int volatile ignore_signals;
  1755. @@ -670,6 +973,7 @@
  1756.      if (signal (*p, SIG_IGN) != SIG_IGN  &&  signal (*p, catchsig) != SIG_IGN)
  1757.        fatal ("signal error");
  1758.  }
  1759. +#endif /* !AMIGA */
  1760.  
  1761.  
  1762.  
  1763. @@ -796,7 +1100,11 @@
  1764.        suppress_common_flag = 0;
  1765.        break;
  1766.      case 'q':
  1767. +#ifdef AMIGA
  1768. +          user_quit = 1;
  1769. +#endif
  1770.        return 0;
  1771. +#ifndef AMIGA
  1772.      case 'e':
  1773.        if (! tmpname && ! (tmpname = private_tempnam (0, "sdiff", 1, 0)))
  1774.          perror_fatal ("temporary file name");
  1775. @@ -864,11 +1172,72 @@
  1776.            while ((size = ck_fread (buf, SDIFF_BUFSIZE, tmp)) != 0)
  1777.          ck_fwrite (buf, size, outfile);
  1778.            ck_fclose (tmp);
  1779. -
  1780.            free (buf);
  1781.          }
  1782.          return 1;
  1783.        }
  1784. +#else /* AMIGA */
  1785. +    case 'e':
  1786. +          if (! tmpname && ! (tmpname = tmpnam (NULL)))
  1787. +        perror_fatal ("temporary file name");
  1788. +
  1789. +      tmpmade = 1;
  1790. +
  1791. +      {
  1792. +        FILE *tmp;
  1793. +
  1794. +            tmp = ck_fopen (tmpname, "w");
  1795. +
  1796. +        if (cmd1 == 'l' || cmd1 == 'b')
  1797. +          lf_copy (left, lenl, tmp);
  1798. +        else
  1799. +          lf_skip (left, lenl);
  1800. +
  1801. +        if (cmd1 == 'r' || cmd1 == 'b')
  1802. +          lf_copy (right, lenr, tmp);
  1803. +        else
  1804. +          lf_skip (right, lenr);
  1805. +
  1806. +        ck_fclose (tmp);
  1807. +
  1808. +            {
  1809. +              struct TagItem STags[3];
  1810. +
  1811. +              sprintf (command_line, "%s \"%s\"", edbin, tmpname);
  1812. +#ifdef KULTUR
  1813. +              STags[0].ti_Tag = (Tag) SYS_Asynch;
  1814. +              STags[0].ti_Data = FALSE;
  1815. +              STags[1].ti_Tag = (Tag) SYS_UserShell;
  1816. +              STags[1].ti_Data = TRUE;
  1817. +              STags[2].ti_Tag = TAG_DONE;
  1818. +#else
  1819. +              STags[0].ti_Tag = SYS_Asynch;
  1820. +              STags[0].ti_Data = FALSE;
  1821. +              STags[1].ti_Tag = SYS_UserShell;
  1822. +              STags[1].ti_Data = TRUE;
  1823. +              STags[2].ti_Tag = TAG_DONE;
  1824. +#endif
  1825. +              if (System (command_line, STags) != 0)
  1826. +                perror_fatal ("Subsidiary editor failed");
  1827. +        }
  1828. +
  1829. +
  1830. +        {
  1831. +          static char *buf;
  1832. +          size_t size;
  1833. +
  1834. +              tmp = ck_fopen (tmpname, "r");
  1835. +
  1836. +              buf = xmalloc (SDIFF_BUFSIZE * sizeof (char));
  1837. +          while ((size = ck_fread (buf, SDIFF_BUFSIZE, tmp)) != 0)
  1838. +        ck_fwrite (buf, size, outfile);
  1839. +              free (buf);
  1840. +
  1841. +          ck_fclose (tmp);
  1842. +        }
  1843. +        return 1;
  1844. +      }
  1845. +#endif /* !AMIGA */
  1846.      default:
  1847.        give_help ();
  1848.        break;
  1849. @@ -947,7 +1316,7 @@
  1850.       const char *dir;
  1851.  {
  1852.    struct stat buf;
  1853. -  return stat (dir, &buf) == 0 && S_ISDIR (buf.st_mode);
  1854. +  return stat ((char *) dir, &buf) == 0 && S_ISDIR (buf.st_mode);
  1855.  }
  1856.  
  1857.  /* Return nonzero if FILE exists.  */
  1858. @@ -956,9 +1325,11 @@
  1859.       const char *file;
  1860.  {
  1861.    struct stat buf;
  1862. -  return stat (file, &buf) == 0;
  1863. +  return stat ((char *) file, &buf) == 0;
  1864.  }
  1865.  
  1866. +#ifndef AMIGA
  1867. +
  1868.  /* These are the characters used in temporary filenames.  */
  1869.  static const char letters[] =
  1870.    "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  1871. @@ -1065,3 +1436,5 @@
  1872.      *lenptr = len;
  1873.    return buf;
  1874.  }
  1875. +
  1876. +#endif /* AMIGA */
  1877. --- Diff22:normal.c    Tue Jul 07 01:23:06 1992
  1878. +++ normal.c    Sun Apr 04 19:39:50 1993
  1879. @@ -20,10 +20,14 @@
  1880.  
  1881.  #include "diff.h"
  1882.  
  1883. +#ifdef KULTUR
  1884. +static void print_normal_hunk (struct change *hunk);
  1885. +#else
  1886.  int change_letter ();
  1887.  void print_normal_hunk ();
  1888.  void print_number_range ();
  1889.  struct change *find_change ();
  1890. +#endif
  1891.  
  1892.  /* Print the edit-script SCRIPT as a normal diff.
  1893.     INF points to an array of descriptions of the two files.  */
  1894. @@ -39,7 +43,7 @@
  1895.     This is a contiguous portion of a complete edit script,
  1896.     describing changes in consecutive lines.  */
  1897.  
  1898. -void
  1899. +static void
  1900.  print_normal_hunk (hunk)
  1901.       struct change *hunk;
  1902.  {
  1903. --- Diff22:io.c    Mon Nov 23 12:44:32 1992
  1904. +++ io.c    Sun Apr 04 19:39:46 1993
  1905. @@ -26,7 +26,13 @@
  1906.  /* Given a hash value and a new character, return a new hash value. */
  1907.  #define HASH(h, c) ((c) + ROL (h, 7))
  1908.  
  1909. +#ifdef KULTUR
  1910. +static void find_and_hash_each_line (struct file_data *);
  1911. +static void find_identical_ends (struct file_data []);
  1912. +static void prepare_text_end (struct file_data *);
  1913. +#else
  1914.  int line_cmp ();
  1915. +#endif
  1916.  
  1917.  /* Guess remaining number of lines from number N of lines so far,
  1918.     size S so far, and total size T.  */
  1919. @@ -326,7 +332,7 @@
  1920.        /* Double (alloc_lines - linbuf_base) by adding to alloc_lines.  */
  1921.        alloc_lines = 2 * alloc_lines - linbuf_base;
  1922.        cureqs = (int *) xrealloc (cureqs, alloc_lines * sizeof (*cureqs));
  1923. -      linbuf = (const char **) xrealloc (linbuf + linbuf_base,
  1924. +      linbuf = (const char **) xrealloc ((VOID *) (linbuf + linbuf_base),
  1925.                           (alloc_lines - linbuf_base)
  1926.                           * sizeof (*linbuf))
  1927.             - linbuf_base;
  1928. @@ -347,7 +353,7 @@
  1929.      {
  1930.        /* Double (alloc_lines - linbuf_base) by adding to alloc_lines.  */
  1931.        alloc_lines = 2 * alloc_lines - linbuf_base;
  1932. -      linbuf = (const char **) xrealloc (linbuf + linbuf_base,
  1933. +      linbuf = (const char **) xrealloc ((VOID *)(linbuf + linbuf_base),
  1934.                           (alloc_lines - linbuf_base)
  1935.                           * sizeof (*linbuf))
  1936.             - linbuf_base;
  1937. @@ -573,7 +579,7 @@
  1938.      {
  1939.        int l = lines++ & prefix_mask;
  1940.        if (l == alloc_lines0)
  1941. -        linbuf0 = (const char **) xrealloc (linbuf0, (alloc_lines0 *= 2)
  1942. +        linbuf0 = (const char **) xrealloc ((VOID *)linbuf0, (alloc_lines0 *= 2)
  1943.                               * sizeof(*linbuf0));
  1944.        linbuf0[l] = p0;
  1945.        while (*p0++ != '\n')
  1946.